<?php
include_once("login.php");
	
$conn = mysql_connect($dbhost,$dbuser,$dbpass) 
	or die('Could not connect: ' . mysql_error());

mysql_select_db($db) 
	or die('Did not find DB: ' . mysql_error());

//Grab data from the http request
$username = $_REQUEST['username'];
$username = mysql_escape_string($username);
$password = $_REQUEST['password'];
$password = mysql_escape_string($password);
$returnValue = 0;

$results = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password';")
	or die('Query failed: ' . mysql_error());
	
if($results){
	if(mysql_num_rows($results) == 1){
		$returnValue = 1;
	}
}

print $returnValue;
mysql_close($conn);
?>